package com.eliza.music.http

import com.eliza.library.utils.net.HttpClient
import com.eliza.library.utils.net.HttpRequest
import com.eliza.library.utils.net.PageInfo
import com.eliza.library.utils.net.SearchWithData
import io.ktor.client.request.setBody
import io.ktor.http.ContentType
import io.ktor.http.URLBuilder
import io.ktor.http.contentType
import kotlinx.serialization.SerializationStrategy

var BaseUrl = "http://localhost:8080/"

val httpClient = HttpClient(URLBuilder(BaseUrl))

val httpRequest = fun(pageInfo: PageInfo, data: SerializationStrategy<Any>) = HttpRequest("/api/v1/song/search") {
    contentType(ContentType.Application.Json)
    setBody(SearchWithData(pageInfo, data))
}